import request from '@/utils/request'

//电话号码注册账号
export const registerApi = (phone:number,password:string) =>{
    return request<any,any>({
        url:`/api/users/register?phone=${phone}&password=${password}`
    })
}
//账号密码登录
export const loginByAccount = (account:number,password:string) =>{
    return request<any,any>({
        url:`/api/sessions/account?account=${account}&password=${password}`
    })
}
//验证手机号是否已经注册
export const checkPhone = (phone:number) =>{
    return request<any,any>({
        url:`/api/users/${phone}`
    })
}

//获取验证码
export const getCode = (phone:number) =>{
    return request<any,any>({
        url:`/api/users/${phone}/code`
    })
}

//校验验证码
export const vertifyCode = (phone:number,code:number) =>{
    return request<any,any>({
        url:`/api/users/${phone}/verifycode?code=${code}`
    })
}

//用验证码登录
export const loginByCode = (phone:number,code:number) =>{
    return request<any,any>({
        url:`/api/sessions/code?phone=${phone}&code=${code}`
    })
}